home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
errcheck.arc
/
errorchk.st
Wrap
Text File
|
1989-03-23
|
4KB
|
147 lines
Having had a small problem recently with this program that is in
Comp.sources.atari.st (address error on exit of other - GEM - program)
I have added a fix. The reason seems to be that when some GEM programs
terminate they are using the GEM-exit vector, and the exit routine
still relies on A4 having a valid contents (I'm not sure). After I
modified the code to save A4 on the stack the problem disappeared.
Here is the relevant part of the code (comments omitted), with 2
instructions added:
DTOPWAIT
MOVE.L $602C,A0
MOVEQ.L #0,D1
BRA.S DTOPAREND
DTOPARNT
ADDQ.L #1,D1
MOVE.L 36(A0),A0
DTOPAREND
TST.L (A0)
BNE.S DTOPARNT
CMP.B #3,D1
BNE.S DTWEND
MOVE.L A4,-(SP) * Added this instruction to save A4 ....
LEA WAITMSG(PC),A4
BRA.S DTOPW3
DTOPW2
EXT.W D0
MOVE.W D0,-(SP)
MOVE.W #2,-(SP)
MOVE.W #3,-(SP)
TRAP #BIOS
ADDQ.L #6,SP
DTOPW3
MOVE.B (A4)+,D0
BNE.S DTOPW2
MOVE.W #2,-(SP)
MOVE.W #2,-(SP)
TRAP #BIOS
ADDQ.L #4,SP
MOVE.L (SP)+,A4 * .... and this one to restore A4
DTWEND
MOVE.L OLDVEC(PC),-(SP)
RTS
Leo. * Not an instruction, more a periferal 8-)
Here is another small memory-resident program to be placed in the AUTO folder.
Did you also had times you wanted to see a program's final (error?) message
when it flashed over your screen and the desktop was painted all over it.
This little program checks whenever a program exits if the caller was the
desktop (it does this by following the links in the basepages); if so, a
message is printed and you can press a key to continue.
The program sets the GEM program exit vector that is at address 0x408; this
vector usually points to a RTS statement (i.e. does nothing). After a keypress
a jump is made to the old vector (in case it WAS used).
This program also prevents the need of coding similar messages into every
program that can be called from the desktop.
It was assembled using the assembler and linker that come with the GST-C
compiler, resulting in a program length of 240 bytes.
My name and address:
L.J.M. de Wit
Nachtegaallaan 7
5731XP Mierlo
Holland.
--------------- H E R E I T A L L S T A R T S -------------------------
MODULE DTOPWAIT
SECTION S.CCODE
GEMDOS EQU 1
BIOS EQU 13
PTERMRES EQU $31
SETEXC EQU 5
ESC EQU $1B
DTWINIT
MOVE.L #-1,-(SP)
MOVE.W #$102,-(SP)
MOVE.W #SETEXC,-(SP)
TRAP #BIOS * Save old GEM exit vector
ADDQ.L #8,SP
LEA.L OLDVEC(PC),A0
MOVE.L D0,(A0)
PEA DTOPWAIT
MOVE.W #$102,-(SP)
MOVE.W #SETEXC,-(SP)
TRAP #BIOS * Set new GEM exit vector
ADDQ.L #8,SP
MOVE.L 4(SP),A0
MOVE.L #$100,D0 * Base page
ADD.L 12(A0),D0 * + text length
ADD.L 20(A0),D0 * + data length
ADD.L 28(A0),D0 * + bss length
CLR.W -(SP) * Return value: 0 for success
MOVE.L D0,-(SP) * # bytes to keep
MOVE.W #PTERMRES,-(SP) * Keep process
TRAP #GEMDOS * Stops here...
DTOPWAIT
MOVE.L $602C,A0
MOVEQ.L #0,D1
BRA.S DTOPAREND
DTOPARNT
ADDQ.L #1,D1
MOVE.L 36(A0),A0
DTOPAREND
TST.L (A0)
BNE.S DTOPARNT
CMP.B #3,D1
BNE.S DTWEND
LEA WAITMSG(PC),A4
BRA.S DTOPW3
DTOPW2
EXT.W D0
MOVE.W D0,-(SP)
MOVE.W #2,-(SP)
MOVE.W #3,-(SP)
TRAP #BIOS
ADDQ.L #6,SP
DTOPW3
MOVE.B (A4)+,D0
BNE.S DTOPW2
MOVE.W #2,-(SP)
MOVE.W #2,-(SP)
TRAP #BIOS
ADDQ.L #4,SP
DTWEND
MOVE.L OLDVEC(PC),-(SP)
RTS
SECTION S.DATA
OLDVEC DC.L 0
WAITMSG DC.B 13,10,ESC,'K',ESC,'p',9,9
DC.B 'Program finished; hit a key to return to desktop',ESC,'q',0
END